<%
Dim strOrder
select case Ssort
	case "id": 
		if Ssort="id" and SN="y" then
			strOrder="caid desc"
			SN="n"
		else
			strOrder="caid"
			SN="y"
		end if
	case "DateReference": 
		if Ssort="DateReference" and SN="y" then
			strOrder="DateReference desc"
			SN="n"
		else
			strOrder="DateReference"
			SN="y"
		end if
	case "AutomatNumber": 
		if Ssort="AutomatNumber" and SN="y" then
			strOrder="CAAutomat desc"
			SN="n"
		else
			strOrder="CAAutomat"
			SN="y"
		end if
	case "Place": 
		if Ssort="Place" and SN="y" then
			strOrder="Place desc"
			SN="n"
		else
			strOrder="Place"
			SN="y"
		end if
	case "NumCompl": 
		if Ssort="NumCompl" and SN="y" then
			strOrder="CANComplect desc"
			SN="n"
		else
			strOrder="CANComplect"
			SN="y"
		end if
	case "NameCompl": 
		if Ssort="NameCompl" and SN="y" then
			strOrder="CANameComplect desc"
			SN="n"
		else
			strOrder="CANameComplect"
			SN="y"
		end if
	case "FileSource": 
		if Ssort="FileSource" and SN="y" then
			strOrder="FileSource desc"
			SN="n"
		else
			strOrder="FileSource"
			SN="y"
		end if
	case "ID_Complect": 
		if Ssort="ID_Complect" and SN="y" then
			strOrder="ID_Complect desc"
			SN="n"
		else
			strOrder="ID_Complect"
			SN="y"
		end if
	case "Result": 
		if Ssort="Result" and SN="y" then
			strOrder="Result desc"
			SN="n"
		else
			strOrder="Result"
			SN="y"
		end if
	case "DateLoad": 
		if Ssort="DateLoad" and SN="y" then
			strOrder="DateLoad desc"
			SN="n"
		else
			strOrder="DateLoad"
			SN="y"
		end if
	case else: strOrder="DateReference desc"
end select
%>